package com.practice.system.controller;

import com.practice.system.service.MaterielService;
import com.practice.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/materiel")
public class MaterielController {
    @Autowired
    MaterielService materielService;

    @PostMapping("/list")
    public R list(@RequestBody Map<String,Object> params){
        return materielService.queryPage(params);
    }
    @PostMapping("/add")
    public R insert(@RequestBody Map<String,Object> params){
        if(materielService.addValue(params))
            return R.ok();
        else
            return R.error();
    }
}
